Skip to content

refactor(router-core): use one path interpolation implementation - #8007

Draft
Sheraff wants to merge 1 commit into
mainfrom
agent/interpolate-path-remove-server-fast-path
Draft

refactor(router-core): use one path interpolation implementation#8007
Sheraff wants to merge 1 commit into
mainfrom
agent/interpolate-path-remove-server-fast-path

Conversation

@Sheraff

@Sheraff Sheraff commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • remove the server-gated plain-template implementation from interpolatePath
  • remove the internal server interpolation option and router call-site plumbing
  • use the canonical segment parser in every environment
  • expand interpolation parity coverage across params, missing params, splats, duplicate slashes, and custom decoders
  • add a focused interpolation benchmark

Why

Path interpolation had two implementations of the route grammar: a server-gated plain-template fast path and the canonical parser. The internal options.server value was also runtime plumbing rather than a compile-time server boundary, so it was not an appropriate dead-code-elimination mechanism. A single path keeps grammar behavior and maintenance centralized.

This PR intentionally does not include the separate parseSegment branch reorder. It is correct and mergeable on its own; the parser optimization is complementary rather than required.

Impact

  • plain templates measured 6.329 ms versus the captured 6.253 ms baseline for 10,000 interpolations (about +1.2%, within the scale of run-to-run noise)
  • braced templates measured 11.322 ms versus 11.278 ms (about +0.4%)
  • react-router.minimal decreases from 85,919 to 85,907 bytes gzip (-12 bytes; raw -47 bytes)

Validation

  • @tanstack/router-core:test:unit: 105 files / 1,495 tests passed, plus 3 expected failures
  • @tanstack/router-core:test:types: TypeScript 5.6 through 7.0 passed
  • @tanstack/router-core:test:eslint: zero errors (existing warnings remain)
  • focused tests/path.bench.ts run
  • react-router.minimal bundle-size scenario on main and this branch
  • confirmed no interpolation server option or router call-site prop remains
  • git diff --check

@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 379f3801-4746-44b4-a02a-1c26dd73afe8

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nx-cloud

nx-cloud Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 7a25c7c

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 10m 36s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 5s View ↗

☁️ Nx Cloud last updated this comment at 2026-08-08 12:37:09 UTC

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Changeset Version Preview

No changeset entries found. Merging this PR will not cause a version bump for any packages.

@pkg-pr-new

pkg-pr-new Bot commented Aug 8, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@8007

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@8007

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@8007

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@8007

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@8007

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@8007

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@8007

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@8007

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@8007

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@8007

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@8007

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@8007

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@8007

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@8007

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@8007

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@8007

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@8007

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@8007

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@8007

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@8007

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@8007

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@8007

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@8007

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@8007

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@8007

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@8007

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@8007

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@8007

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@8007

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@8007

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@8007

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@8007

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@8007

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@8007

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@8007

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@8007

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@8007

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@8007

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@8007

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@8007

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@8007

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@8007

commit: 7a25c7c

@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Bundle Size Benchmarks

  • Commit: 426830291b4e
  • Measured at: 2026-08-08T12:27:39.136Z
  • Baseline source: history:c568caf3f376
  • Dashboard: bundle-size history

The following scenarios have bundle-size changes compared with the baseline:

Scenario Current (gzip) Delta vs baseline Initial gzip Raw Brotli Trend
react-router.minimal 83.89 KiB -12 B (-0.01%) 83.76 KiB 262.57 KiB 73.00 KiB █████████▁▁▁
react-router.full 87.39 KiB -8 B (-0.01%) 87.25 KiB 274.29 KiB 76.09 KiB █████████▁▁▁
solid-router.minimal 33.20 KiB -15 B (-0.04%) 33.08 KiB 96.41 KiB 29.92 KiB █████████▁▁▁
solid-router.full 38.03 KiB -18 B (-0.05%) 37.91 KiB 111.04 KiB 34.19 KiB █████████▁▁▁
vue-router.minimal 49.48 KiB -13 B (-0.03%) 49.36 KiB 138.16 KiB 44.61 KiB █████████▁▁▁
vue-router.full 55.06 KiB -14 B (-0.02%) 54.93 KiB 156.33 KiB 49.54 KiB █████████▁▁▁
react-start.minimal 96.65 KiB -10 B (-0.01%) 96.52 KiB 304.74 KiB 83.69 KiB █████████▁▁▁
react-start.deferred-hydration 97.38 KiB -10 B (-0.01%) 96.54 KiB 306.10 KiB 84.30 KiB █████████▁▁▁
react-start.full 99.82 KiB -14 B (-0.01%) 99.68 KiB 314.45 KiB 86.54 KiB █████████▁▁▁
react-start.rsbuild.minimal 99.98 KiB -18 B (-0.02%) 99.80 KiB 315.28 KiB 86.19 KiB ▁▁▁▇▇▇▇████▆
react-start.rsbuild.minimal-iife 100.38 KiB -21 B (-0.02%) 100.22 KiB 316.22 KiB 86.54 KiB ▁▁▁▇▇▆▆████▆
react-start.rsbuild.full 103.29 KiB -18 B (-0.02%) 103.12 KiB 325.38 KiB 88.96 KiB ▁▁▁▆▆▅▅████▆
solid-start.minimal 45.93 KiB -16 B (-0.03%) 45.80 KiB 137.41 KiB 40.88 KiB █████████▁▁▁
solid-start.deferred-hydration 49.00 KiB -9 B (-0.02%) 45.86 KiB 144.87 KiB 43.65 KiB █████████▁▁▁
solid-start.full 51.00 KiB -16 B (-0.03%) 50.88 KiB 152.80 KiB 45.21 KiB █████████▁▁▁
vue-start.minimal 65.47 KiB -17 B (-0.03%) 65.35 KiB 188.92 KiB 58.25 KiB █████████▁▁▁
vue-start.full 69.28 KiB -8 B (-0.01%) 69.15 KiB 201.19 KiB 61.57 KiB █████████▁▁▁

Current gzip tracks all emitted client JS chunks. Initial gzip tracks only the entry/import graph. Trend sparkline is historical current gzip ending with this PR measurement; lower is better.

@codspeed-hq

codspeed-hq Bot commented Aug 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 7.49%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 4 improved benchmarks
❌ 8 (👁 6) regressed benchmarks
✅ 168 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation ssr dehydrate rich types (solid) 87.3 ms 95.7 ms -8.77%
Simulation ssr dehydrate plain control (solid) 119.6 ms 129.2 ms -7.49%
Memory mem server error-paths redirect (solid) 588.2 KB 281.8 KB ×2.1
Memory mem client preload-churn (vue) 776.2 KB 741.4 KB +4.7%
Simulation ssr control-flow unmatched 404 (react) 67.2 ms 64.3 ms +4.55%
Memory mem client navigation-churn (solid) 570.2 KB 553 KB +3.11%
👁 Memory mem server server-fn-churn (vue) 263.1 KB 273.4 KB -3.78%
👁 Memory mem server error-paths not-found (solid) 416.3 KB 733.4 KB -43.23%
👁 Memory mem server streaming-peak chunked (solid) 30.3 MB 32.2 MB -5.91%
👁 Memory mem server error-paths not-found (react) 256.3 KB 291.3 KB -12.01%
👁 Memory mem server error-paths redirect (react) 204.1 KB 227.1 KB -10.13%
👁 Memory mem server error-paths unmatched (react) 263.6 KB 542.4 KB -51.4%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing agent/interpolate-path-remove-server-fast-path (7a25c7c) with main (c568caf)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant